#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :common_devisor_23.py
# @Time      :2020/6/22 15:37
# @Author    :Administrator


def gcd(x, y):
    if y > x:
        x, y = y, x
    if x % y == 0:
        return y
    # 倒序求最大公约数更合理
    for i in range(y // 2 + 1, 1, -1):
        if y % i == 0 and x % i == 0:
            return i
    return 0


while True:
    a = int(input("Input 'x' :"))
    b = int(input("Input 'y':"))
    print(gcd(a, b))
